package com.mall.implementation;

import java.util.ArrayList;

import com.mall.core.Customer;
import com.mall.core.Item;
import com.mall.core.Receipt;
import com.mall.core.ShopingCart;
import com.mall.core.Store;
import com.mall.util.StringWrapper;

public class CustomerImpl implements com.mall.core.Customer {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

private int id=0;
private StringWrapper username;
private StringWrapper password;
private StringWrapper address;
private StringWrapper name;
private StringWrapper city;
private StringWrapper zipcode;
private StringWrapper phonenumber;
private StringWrapper email;

private boolean login =false;
private boolean signup = false;
private boolean logout = false;
private boolean instore = false;
private boolean inmall = false;
private boolean backend = false;
private boolean frontend = false;
public boolean equals(Customer customer){
	boolean equal =customer.getUserName().equals(this.username)&&customer.getPassword().equals(this.password);
	
	return equal;}
	@Override
	public boolean login() {
		login =false;
		logout = false;
		instore = false;
		inmall = true;
		backend = false;

		logout = false;
		return login =true;
	}

	@Override
	public boolean logout() {
		login = false;
		instore = false;
		inmall = false;
		backend = false;
		return logout = true;
	}

	@Override
	public void signup() {
		signup = true;
		
	}

	@Override
	public boolean isInStore() {

		return instore;
	}

	@Override
	public boolean isInMall() {
		
		return inmall;
	}

	@Override
	public boolean isInFrontEnd() {
		
		return frontend ;
	}

	@Override
	public boolean isInbackEnd() {
		
		return backend;
	}

	@Override
	public boolean isLoggedOut() {
	
		return logout;
	}

	@Override
	public boolean isLogedIn() {
		
		return login;
	}

	@Override
	public StringWrapper getName() {

		return this.name;
	}


	@Override
	public StringWrapper getPassword() {
		return this.password;
	}



	@Override
	public StringWrapper getAddress() {

		return this.address;
	}



	@Override
	public void AddItemstoShopingcart(ShopingCart shopingcart, Item item) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void removeItemsFromShopingcart(ShopingCart shopingcart, Item item) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void returnItems(Receipt receipt, ArrayList<Item> returnitems) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void pay(ShopingCart shopingcart) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void visitStore(Store store) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void exitStore() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public int getId() {

		return this.id;
	}

	@Override
	public void setId(int id) {
		this.id =id;
		
	}

	@Override
	public StringWrapper getUserName() {
		
		return this.username;
	}


	@Override
	public StringWrapper getCityName() {

		return this.city;
	}



	@Override
	public StringWrapper getZipCode() {

		return this.zipcode;
	}


	@Override
	public StringWrapper getPhoneNumber() {

		return this.phonenumber;
	}

	@Override
	public void setName(StringWrapper name) {

		this.name = name;
	}

	@Override
	public void setPassword(StringWrapper password) {
		this.password=password;
		
	}

	@Override
	public void setAddress(StringWrapper address) {
		
		this.address=address;
	}

	@Override
	public void setUserName(StringWrapper username) {
	this.username= username;
		
	}

	@Override
	public void setCityName(StringWrapper city) {
		this.city=city;
		
	}

	@Override
	public void setUserZipCode(StringWrapper zipcode) {
		this.zipcode=zipcode;
		
	}

	@Override
	public void setPhoneNumber(StringWrapper phonenumber) {
		this.phonenumber=phonenumber;
		
	}

	@Override
	public void setInstore() {

		instore=true;
	}

	@Override
	public void setOutofstore() {

		instore =false;
	}
public static void main(String args[]){
	
	CustomerImpl cut1 = new CustomerImpl();
	cut1.setUserName(new StringWrapper("amos"));
	cut1.setPassword(new StringWrapper("jesus1"));
	CustomerImpl cut2 = new CustomerImpl();
	cut2.setUserName(new StringWrapper("amos"));
	cut2.setPassword(new StringWrapper("jesus1"));
	cut1.login();
	System.out.println(cut1.EnterStore());
	System.out.println(cut1.gotoBackend());
	System.out.println(cut1.leavestore());
	System.out.println(cut1.isInMall());
	System.out.println(cut1.EnterStore());
	System.out.println(cut1.isInMall());
	System.out.println(cut1.gotoBackend());
	System.out.println(cut1.isInMall());
	System.out.println(cut1.isInStore());
}

@Override
public boolean EnterStore() {
	login =true;
	logout = false;
	instore = true;
	inmall = true;
	backend = false;
	frontend= false;
	return instore;
}
@Override
public boolean leavestore() {
	login =true;
	logout = false;
	instore = false;
	inmall = true;
	backend = false;
	frontend= true;
	signup=true;
return instore;
}
@Override
public boolean gotoBackend() {

	logout = false;
	inmall = true;
	backend = false;
	frontend= false;
	return backend;
}
	

}
